package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author lilh
 * @date 2019-07-17 16:38
 */
public enum ModelCategoryEnum {

    /**
     * 历史
     */
    HISTORY("HISTORY", "历史"),

    RUNNING("RUNNING", "运行"),

    DESIGN("DESIGN", "设计");

    private String code;

    private String description;

    private static Map<String, String> codeToDescriptionMap = new HashMap<>(3);

    static {
        codeToDescriptionMap = Arrays.stream(values()).collect(Collectors.toMap(ModelCategoryEnum::getCode, ModelCategoryEnum::getDescription));
    }

    ModelCategoryEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String getDescritionByCode(String code) {
        return codeToDescriptionMap.get(code);
    }

}
